### Project 11 Principle and Application of Bluetooth Remote Control **1.Principle** Bluetooth, as the name implies, blue teeth, and he is not used to bite people, but a wireless data transmission method. Bluetooth technology is a wireless standard technology that enables short-range data exchange among fixed devices, mobile devices, and personal area networks of buildings (UHF radio waves in the ISM band of 2.4 to 2.485 GHz). There are two kinds of commonly used Bluetooth module on the market, HC-05 and HC-06 models. The difference between them is that the HC-05 is a master-slave one. It can not only make small reports to its own “master”, but also can receive the command given to it. TheHC-06 can only work in slave mode, which can only accept the superior command. For instance, in many cases you may want to be an overbearing man, lettingthe subordinates obey the order without any nonsense. So in such situation, it is enough to use the HC-06 module shown as below. ![](media/image-20251218172320097.png) **2.Specification Parameters** 1) Bluetooth Protocol: Bluetooth 2.1+ EDR Standard 2) USB Protocol: USB v1.1/2.0 3) Operating Frequency: 2.4GHz ISM Frequency Band 4) Modulation Mode: Gauss Frequency Shift Keying 5) Transmit Power: ≤ 4dBm, Second Stage 6) Sensitivity: ≤-84dBm at 0.1% Bit Error Rate 7) Transmission Speed: 2.1Mbps(Max)/160 kbps(Asynchronous);1Mbps/1Mbps(Synchronous) 8) Safety Feature: Authentication and Encryption 9) Supported Configuration: Bluetooth Serial Port (major and minor) 10) Supply Voltage: DC 5V 11) Operating Temperature: -20 to 55℃ **3.Wiring Diagram** Next, we are going to do a small experiment. When Bluetooth module receives a signal sent by phone, finally control an LED on and off. ![](media/image-20251218172405058.png) **4.Source Code as below** Code ```c int val; int led=11; void setup() { Serial.begin(9600); pinMode(11,OUTPUT); } void loop() { val=Serial.read(); if(val=='a') { digitalWrite(11, HIGH); // turn the LED on (HIGH is the voltage level) } if(val=='b') { digitalWrite(11, LOW); // turn the LED off by making the voltage LOW } } ``` **5.Example Result** After wiring, upload the above code to the board, and connect well the Bluetooth module. Pay more attention to the connecting direction of Bluetooth module. Plug it correctly and you should see an LED on the module flash. ![](media/image-20251218172854491.png) Pay more attention that here you must first upload the code to the board and then plug in the Bluetooth module, otherwise the program fails to compile. The principle is that data transmits of Bluetooth module will occupy the microcontroller’s TX and RX pins that are also used for the code upload of microcontroller, so it exists a conflict. After uploading the code, you have to do another thing, that is, install an application of Bluetooth serial assistant on the phone. **Please download the app here**![](media/image-20251218173017243.png). ![](media/image-20251219102809726.png) The Bluetooth we used here is Bluetooth 2.0. Currently, it only supports the Android devices. Do not support Apple's devices. Please pay attention to this when using it. After the serial assistant is installed, we must first connect the device, open the mobile Bluetooth, search for a Bluetooth device. If find a Bluetooth device named HC-06, pair and enter 1234, finally you should see the paired device shown as below. ![](media/image-20251218173335441.png) ![](media/image-20251218173343313.png) Then open the Bluetooth serial communication APP, namely BT Client, and connect well the Bluetooth just paired. Done connecting, an LED on the Bluetooth module is always on. If enter the letter a in the Bluetooth APP, the LED connected on the pin 11 is on; if enter the letter b, the LED will be off.